import { toast } from 'sonner';
import { successToast, errorToast, infoToast, warningToast } from './toast-config';

// 统一的提示工具函数
export const message = {
  // 成功提示
  success: (message: string, options?: any) => {
    return successToast(message, options);
  },

  // 错误提示
  error: (message: string, options?: any) => {
    return errorToast(message, options);
  },

  // 信息提示
  info: (message: string, options?: any) => {
    return infoToast(message, options);
  },

  // 警告提示
  warning: (message: string, options?: any) => {
    return warningToast(message, options);
  },

  // 加载提示
  loading: (message: string, options?: any) => {
    return toast.loading(message, {
      position: 'top-center',
      style: {
        background: 'linear-gradient(135deg, #6b7280, #4b5563)',
        color: 'white',
        border: 'none',
        borderRadius: '12px',
        boxShadow: '0 10px 25px rgba(107, 114, 128, 0.3)',
        fontSize: '14px',
        fontWeight: '500',
        padding: '12px 16px',
        minWidth: '300px',
        textAlign: 'center',
        animation: 'fadeOut 1s ease-in-out 1s forwards'
      },
      icon: '⏳',
      ...options
    });
  }
};

// 深色模式适配的提示函数
export const darkMessage = {
  success: (message: string, options?: any) => {
    return successToast(message, {
      style: {
        background: 'linear-gradient(135deg, #10b981, #059669)',
        color: 'white',
        border: 'none',
        borderRadius: '12px',
        boxShadow: '0 10px 25px rgba(16, 185, 129, 0.4)',
        fontSize: '14px',
        fontWeight: '500',
        padding: '12px 16px',
        minWidth: '300px',
        textAlign: 'center'
      },
      ...options
    });
  },

  error: (message: string, options?: any) => {
    return errorToast(message, {
      style: {
        background: 'linear-gradient(135deg, #ef4444, #dc2626)',
        color: 'white',
        border: 'none',
        borderRadius: '12px',
        boxShadow: '0 10px 25px rgba(239, 68, 68, 0.4)',
        fontSize: '14px',
        fontWeight: '500',
        padding: '12px 16px',
        minWidth: '300px',
        textAlign: 'center'
      },
      ...options
    });
  },

  info: (message: string, options?: any) => {
    return infoToast(message, {
      style: {
        background: 'linear-gradient(135deg, #3b82f6, #2563eb)',
        color: 'white',
        border: 'none',
        borderRadius: '12px',
        boxShadow: '0 10px 25px rgba(59, 130, 246, 0.4)',
        fontSize: '14px',
        fontWeight: '500',
        padding: '12px 16px',
        minWidth: '300px',
        textAlign: 'center'
      },
      ...options
    });
  },

  warning: (message: string, options?: any) => {
    return warningToast(message, {
      style: {
        background: 'linear-gradient(135deg, #f59e0b, #d97706)',
        color: 'white',
        border: 'none',
        borderRadius: '12px',
        boxShadow: '0 10px 25px rgba(245, 158, 11, 0.4)',
        fontSize: '14px',
        fontWeight: '500',
        padding: '12px 16px',
        minWidth: '300px',
        textAlign: 'center'
      },
      ...options
    });
  }
}; 